<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" id="viewport" content="width=device-width, initial-scale=1">
    <title>活动</title>
    <link rel="stylesheet" href="../../front/css/common.css">
    <script type="text/javascript" src="../../front/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../front/js/common.js"></script>
</head>
<body>
<div class="ly_header header2">活动
    <div class="ly_left goback"><img src="../../front/image/gobackbai.png" alt=""></div>
</div>
<div id="appactivity" style="margin-bottom: 49px">
    <div style="background: white;padding: 0 15px;">
        <div class="box2 left dw">
            <img src="../../front/newimg/appactivityselect.png" style="height: 71px;width: 100%;" alt="">
            <div class="dw_text5">申请的活动</div>
        </div>
        <div class="box2 left dw showhide" boxshow="#signactivity" boxhide="#appactivity">
            <img src="../../front/newimg/signactivity.png" class="" style="height: 71px;width: 100%;" alt="">
            <div class="dw_text5">报名的活动</div>
        </div>
        <div style="clear: both"></div>
    </div>
    <div id="appactivitymain"></div>

</div>
<div id="signactivity"  style="margin-bottom: 49px" class="hide">
    <div style="background: white;padding: 0 15px">
        <div class="box2 left dw showhide" boxshow="#appactivity" boxhide="#signactivity">
            <img src="../../front/newimg/appactivity.png" class="" style="height: 71px;width: 100%;" alt="">
            <div class="dw_text5">申请的活动</div>
        </div>
        <div class="box2 left dw">
            <img src="../../front/newimg/signactivityselect.png" style="height: 71px;width: 100%;" alt="">
            <div class="dw_text5">报名的活动</div>
        </div>
        <div style="clear: both"></div>
    </div>
    <div id="signactivitymain"></div>
    <div class="activitylist">
        <div>
            <img class="imgmindw activityimg" src="../../front/newimg/activityleft1.png" alt="">任务名称
        </div>
        <div>
            <div class="box75 left" style="font-size: 0.9em;">
                <div>
                    <span class="color6">活动状态</span><span class="hdbmz padl5">活动报名中</span>
                </div>
                <div class="color6" style="font-size: 0.8em">2019-1-11/8:25:25</div>
            </div>
            <div class="box4 left">
                <img src="../../front/newimg/quxiaobm.png" class="acceptteskimg" alt="">
            </div>
            <div style="clear: both"></div>
        </div>
        <div style="font-size: 0.7em;">
            <span class="">活动最大人数：10</span>
            <span style="padding: 0 10px;">|</span>
            <span class="">报名人数：10</span>
        </div>
    </div>
    <div class="activitylist mart5">
        <div>
            <img class="imgmindw activityimg" src="../../front/newimg/activityleft1.png" alt="">任务名称
        </div>
        <div>
            <div class="box75 left" style="font-size: 0.9em;">
                <div>
                    <span class="color6">活动状态</span><span class="hdqx padl5">活动取消</span>
                </div>
                <div class="color6" style="font-size: 0.8em">2019-1-11/8:25:25</div>
            </div>
            <div class="box4 left"></div>
            <div style="clear: both"></div>
        </div>
        <div style="font-size: 0.7em;">
            <span class="">活动最大人数：10</span>
            <span style="padding: 0 10px;">|</span>
            <span class="">报名人数：10</span>
        </div>
    </div>
    <div class="activitylist mart5">
        <div>
            <img class="imgmindw activityimg" src="../../front/newimg/activityleft1.png" alt="">任务名称
        </div>
        <div>
            <div class="box75 left" style="font-size: 0.9em;">
                <div>
                    <span class="color6">活动状态</span><span class="hdjs padl5">活动结束</span>
                </div>
                <div class="color6" style="font-size: 0.8em">2019-1-11/8:25:25</div>
            </div>
            <div class="box4 left"></div>
            <div style="clear: both"></div>
        </div>
        <div style="font-size: 0.7em;">
            <span class="">活动最大人数：10</span>
            <span style="padding: 0 10px;">|</span>
            <span class="">报名人数：10</span>
        </div>
    </div>
    <div class="activitylist mart5">
        <div>
            <img class="imgmindw activityimg" src="../../front/newimg/activityleft1.png" alt="">任务名称
        </div>
        <div>
            <div class="box75 left" style="font-size: 0.9em;">
                <div>
                    <span class="color6">活动状态</span><span class="hdyzs padl5">活动已赞赏</span>
                </div>
                <div class="color6" style="font-size: 0.8em">2019-1-11/8:25:25</div>
            </div>
            <div class="box4 left"></div>
            <div style="clear: both"></div>
        </div>
        <div style="font-size: 0.7em;">
            <span class="">活动最大人数：10</span>
            <span style="padding: 0 10px;">|</span>
            <span class="">报名人数：10</span>
        </div>
    </div>
</div>
<div class="bottombtn" style="">
    <a th:href="@{/front/activity/toAppactivity.action}">
        <img src="../../front/newimg/release.png" style="height: 49px;width: 100%;" alt="">
    </a>

</div>
</body>
<script type="text/javascript" src="../../front/js/information.js"></script>
<script>
function signactivity(data){
    var temp='<div class="activitylist mart5">'
        +'<div>'
            +'<img class="imgmindw activityimg" src="../../front/newimg/activityleft1.png" alt="">'+data.activityName
        +'</div>'
        +'<div>'
            +'<div class="box75 left" style="font-size: 0.9em;">'
                +'<div>'
                    +'<span class="color6">活动状态</span>'
                    switch(data.activityStatus){
                    case 'UN_AUDIT':temp+='<span class="sqshtg padl5 ">申请待审核</span>';
                            break;
                    case 'APPLY_CANCEL':temp+='<span class="sqshtg padl5">申请取消</span>';
                            break;
                    case 'AUDIT_PASS':temp+='<span class="sqshtg padl5">申请审核通过</span>';
                            break;
                    case 'AUDIT_FAIL':temp+='<span class="sqshtg padl5">申请审核不通过</span>';
                            break;
                    case 'ACTIVITY_SIGN_UP':temp+='<span class="sqshtg padl5">活动报名中</span>';
                            break;
                    case 'ACTIVITY_IN_PROGRESS':temp+='<span class="sqshtg padl5">活动进行中</span>';
                            break;
                    case 'ACTIVITY_CANCEL':temp+='<span class="sqshtg padl5">活动取消</span>';
                            break;
                    case 'ACTIVITY_FINISHED':temp+='<span class="sqshtg padl5">活动结束</span>';
                            break;
                    case 'ACTIVITY_APPRECIATED':temp+='<span class="sqshtg padl5">活动已赞赏</span>';
                            break;
                }
                temp+='</div>'
                +'<div class="color6" style="font-size: 0.8em">'+data.createTimeStr+'</div>'
            +'</div>'
            +'<div class="box4 left">'
            if(data.activityStatus=="UN_AUDIT"){
                temp+= '<img src="../../front/newimg/quxiaobm.png" class="acceptteskimg cancelregistration" cancelregistration='+data.id+' alt="">'
            }
            temp+='</div>'
            +'<div style="clear: both"></div>'
        +'</div>'
        +'<div style="font-size: 0.7em;">'
           +'<span class="">活动最大人数：'+data.activityMaxNum+'</span>'
            +'<span style="padding: 0 10px;">|</span>'
            +'<span class="">报名人数：'+data.activitySignUpCount+'</span>'
        +'</div>'
    +'</div>'
    return temp;
}
function appactivity(data){
    var temp='<div class="activitylist mard5">'
        +'<div>'
            +'<img class="imgmindw activityimg" src="../../front/newimg/activityleft.png" alt="">'+data.activityName
        +'</div>'
        +'<div>'
            +'<div class="box75 left" style="font-size: 0.9em;">'
                +'<div>'
                    +'<span class="color6">活动状态</span>'
                switch(data.activityStatus){
                    case 'UN_AUDIT':temp+='<span class="sqshtg padl5 ">申请待审核</span>';
                            break;
                    case 'APPLY_CANCEL':temp+='<span class="sqshtg padl5">申请取消</span>';
                            break;
                    case 'AUDIT_PASS':temp+='<span class="sqshtg padl5">申请审核通过</span>';
                            break;
                    case 'AUDIT_FAIL':temp+='<span class="sqshtg padl5">申请审核不通过</span>';
                            break;
                    case 'ACTIVITY_SIGN_UP':temp+='<span class="sqshtg padl5">活动报名中</span>';
                            break;
                    case 'ACTIVITY_IN_PROGRESS':temp+='<span class="sqshtg padl5">活动进行中</span>';
                            break;
                    case 'ACTIVITY_CANCEL':temp+='<span class="sqshtg padl5">活动取消</span>';
                            break;
                    case 'ACTIVITY_FINISHED':temp+='<span class="sqshtg padl5">活动结束</span>';
                            break;
                    case 'ACTIVITY_APPRECIATED':temp+='<span class="sqshtg padl5">活动已赞赏</span>';
                            break;
                }
                temp+='</div>'
                +'<div class="color6" style="font-size: 0.8em">'+data.createTimeStr+'</div>'
            +'</div>'
            +'<div class="box4 left">'
            if(data.activityStatus=="UN_AUDIT"){
                temp+='<img src="../../front/newimg/quxiao.png" class="acceptteskimg cancelactivity" cancelactivity="'+data.id+'" alt="">'
            }
            temp+='</div>'
            +'<div style="clear: both"></div>'
        +'</div>'
        if(data.activityStatus=="UN_AUDIT"){
            temp+='<div style="font-size: 0.7em;">'
               +'<span class="">活动最大人数：'+data.activityMaxNum+'</span>'
                +'<span style="padding: 0 10px;">|</span>'
                +'<span class="">报名人数：'+data.activitySignUpCount+'</span>'
                +'<span style="padding: 0 10px;">|</span>'
                +'<span class="">签到人数：'+data.activitySignInCount+'</span>'
            +'</div>'
        }
    temp+='</div>'
    return temp;
}
$(document).on("click",".cancelactivity",function(){
    var id=$(this).attr("cancelactivity");
    var that=$(this);
    $.ajax({
        url: "cancelActivity.action",
        type: "post",
        data: {id:id}, //发送数据,
        dataType: "json",
        async: false,
        success: function(data){
            if(data.success){
                $(that).remove();
            }

        },
        error:function(){
            alert()
        }
    })
})
$(document).on("click",".cancelregistration",function(){
    var id=$(this).attr("cancelregistration");
    var type="ACTIVITY"
    var that=$(this);
    $.ajax({
        url: "cancelSignUp.action",
        type: "post",
        data: {id:id,entityType:type}, //发送数据,
        dataType: "json",
        async: false,
        success: function(data){
            if(data.success){
                $(that).remove();
            }

        },
        error:function(){
            alert()
        }
    })
})
$(function(){
    $.ajax({
        url: "queryApplyActivityList.action",
        type: "post",
        data: {currentPage:1,pageSize:10}, //发送数据,
        dataType: "json",
        success: function(data){
            if(data.success){
                var temp=""
                for(var i=0;i<data.resultList.length;i++){

                    temp+=appactivity(data.resultList[i])
                }
                $("#appactivitymain").html(temp)
            }

        },
        error:function(){
            alert()
        }
    })
    $.ajax({
        url: "querySignUpActivityList.action",
        type: "post",
        data: {currentPage:1,pageSize:10}, //发送数据,
        dataType: "json",
        success: function(data){
            var temp=""
            for(var i=0;i<data.resultList.length;i++){

                temp+=appactivity(data.resultList[i])
            }
            $("#signactivitymain").html(temp)


        },
        error:function(){
            alert()
        }
    })
})

</script>
</html>